package com.nulldev.util.web.HttpServer3.extensions.sse;

import java.io.IOException;
import java.util.TimerTask;

class Heartbeat extends TimerTask {

	private SSESession mEventSource;

	public Heartbeat(final SSESession es) {
		mEventSource = es;
	}

	@Override
	public void run() {
		if (mEventSource.isOpen()) {
			try {
				mEventSource.sendComment("hb");
			} catch (IOException e) {
			}
		}
	}
}